<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition>

        <p:dialog id="PatientEditDlg" widgetVar="PatientEditDialog" modal="true" resizable="false" appendToBody="true" header="#{myBundle.EditPatientTitle}">

            <h:form id="PatientEditForm">

                <h:panelGroup id="display">
                    <p:panelGrid  columns="2" rendered="#{patientController.selected != null}">

                        <h:outputLabel value="#{myBundle.EditPatientLabel_pid}" for="pid" />
                        <h:outputText id="pid" value="#{patientController.selected.pid}" />

                        <p:outputLabel value="#{myBundle.EditPatientLabel_cnic}" for="cnic" />
                        <p:inputText id="cnic" value="#{patientController.selected.cnic}" title="#{myBundle.EditPatientTitle_cnic}" />

                        <p:outputLabel value="#{myBundle.EditPatientLabel_fname}" for="fname" />
                        <p:inputText id="fname" value="#{patientController.selected.fname}" title="#{myBundle.EditPatientTitle_fname}" required="true" requiredMessage="#{myBundle.EditPatientRequiredMessage_fname}"/>

                        <p:outputLabel value="#{myBundle.EditPatientLabel_lname}" for="lname" />
                        <p:inputText id="lname" value="#{patientController.selected.lname}" title="#{myBundle.EditPatientTitle_lname}" required="true" requiredMessage="#{myBundle.EditPatientRequiredMessage_lname}"/>

                        <p:outputLabel value="#{myBundle.EditPatientLabel_careOf}" for="careOf" />
                        <p:inputText id="careOf" value="#{patientController.selected.careOf}" title="#{myBundle.EditPatientTitle_careOf}" required="true" requiredMessage="#{myBundle.EditPatientRequiredMessage_careOf}"/>

                        <p:outputLabel value="#{myBundle.EditPatientLabel_gender}" for="gender" />
                        <p:inputText id="gender" value="#{patientController.selected.gender}" title="#{myBundle.EditPatientTitle_gender}" required="true" requiredMessage="#{myBundle.EditPatientRequiredMessage_gender}"/>

                        <p:outputLabel value="#{myBundle.EditPatientLabel_dob}" for="dob" />
                        <p:calendar id="dob" pattern="MM/dd/yyyy" value="#{patientController.selected.dob}" title="#{myBundle.EditPatientTitle_dob}" required="true" requiredMessage="#{myBundle.EditPatientRequiredMessage_dob}" showOn="button"/>

                        <p:outputLabel value="#{myBundle.EditPatientLabel_hno}" for="hno" />
                        <p:inputText id="hno" value="#{patientController.selected.hno}" title="#{myBundle.EditPatientTitle_hno}" required="true" requiredMessage="#{myBundle.EditPatientRequiredMessage_hno}"/>

                        <p:outputLabel value="#{myBundle.EditPatientLabel_street}" for="street" />
                        <p:inputText id="street" value="#{patientController.selected.street}" title="#{myBundle.EditPatientTitle_street}" required="true" requiredMessage="#{myBundle.EditPatientRequiredMessage_street}"/>

                        <p:outputLabel value="#{myBundle.EditPatientLabel_town}" for="town" />
                        <p:inputText id="town" value="#{patientController.selected.town}" title="#{myBundle.EditPatientTitle_town}" required="true" requiredMessage="#{myBundle.EditPatientRequiredMessage_town}"/>

                        <p:outputLabel value="#{myBundle.EditPatientLabel_city}" for="city" />
                        <p:inputText id="city" value="#{patientController.selected.city}" title="#{myBundle.EditPatientTitle_city}" required="true" requiredMessage="#{myBundle.EditPatientRequiredMessage_city}"/>

                        <p:outputLabel value="#{myBundle.EditPatientLabel_contact}" for="contact" />
                        <p:inputText id="contact" value="#{patientController.selected.contact}" title="#{myBundle.EditPatientTitle_contact}" required="true" requiredMessage="#{myBundle.EditPatientRequiredMessage_contact}"/>
                    </p:panelGrid>
                    <p:commandButton actionListener="#{patientController.save}" value="#{myBundle.Save}" update="display,:PatientListForm:datalist,:growl" oncomplete="handleSubmit(xhr,status,args,PatientEditDialog);"/>
                    <p:commandButton value="#{myBundle.Cancel}" onclick="PatientEditDialog.hide()"/>
                </h:panelGroup>

            </h:form>

        </p:dialog>

    </ui:composition>

</html>
